import request from '@/utils/request'

// 用户列表
export const  getUserListApi = (page:number,keyword:string,user_level_id:number,limit?:number) => request.get(`user/${page}`,{params:{limit,keyword,user_level_id}})

interface addUser{
    username : string,
    password : number,
    status : number,
    nickname ?: string,
    phone ?: number,
    email : string,
    avatar ?: string,
    user_level_id : number
}
// 增加用户
export const addUserApi = (addUser : addUser) => request.post('user',{...addUser})

interface updataUser{
    id : number,
    username : string,
    password : string,
    status : string,
    nickname ?:string,
    phone ?:string,
    email ?:string,
    avatar ?: string,
    user_level_id : string
}
// 修改用户
export const updatUserApi = (data:updataUser) => request.post(`user/${data.id}`,{...data})

// 修改用户状态
export const updataUserStateApi = (id:number,status:number) => request.post(`user/${id}/update_status`,{status})

// 删除会员
export const removeUserApi = (id:number) => request.post(`user/${id}/delete`)